import Axios from "axios";
import {get,post} from "./http";

//
//============identify记录相关================
export const getModifiedDetailsOfNum = (userid, num) => get(`/identify-details/getByModifyNum/${userid}?modifyNum=${num}`);

export const updateModifiedDetailsNum = (params) => post(`/identify-details/update`, params);

export const selectIdentifyById =(id) => get(`identify/selectById/${id}`);

export const selectIdentifyByUser =(userid) => get(`identify/find_pic/${userid}`);

export const getIdentifyOfState = (userid,state) => get(`identify/find_state_pic/${userid}?state=${state}`);

export const selectHarvestById =(id) => get(`harvest/selectById/${id}`);

export const selectHarvestByUser =(userid) => get(`harvest/find_pic/${userid}`);

export const getHarvestOfState = (userid,state) => get(`harvest/find_state_pic/${userid}?state=${state}`);
//============识别相关================
export const getAllIdentify =() => get(`identify/all`);

export const correctCompelet = (id, state) => get(`identify/correct_complete/${id}?state=${state}`);
//============用户相关================
//查询用户
export const getAllConsumer =() => get(`consumer/allConsumer`);
//注册
export const SignUp =(params) => post(`/consumer/add`,params);
//登录
export const loginIn =(params) => post(`/consumer/login`,params);
//根据用户id查询该用户的详细信息
export const getUserOfId =(id) => get(`/consumer/selectById?id=${id}`);
//更新用户信息
export const updateUserMsg =(params) => post(`/consumer/update`,params);

export const addUsersModifyCount = (id) => get(`/consumer/addModifyCount?id=${id}`)

export const addUsersIdentifyCount = (id) => get(`/consumer/addIdentifyCount?id=${id}`)


//============估产相关================
//查询所有识别记录
export const getAllHarvest =() => get(`harvest/all`);

export const detailOfDetailId =(id) => get(`identify-details/get/${id}`);
//根据歌单id查询歌曲列表
export const listIdentifyDetail = (identifyID) => get(`identify-details/get_pic_strs/${identifyID}`);


// =====================控制台页面=========================
// 获取用户的操作记录
export const getCollectOfUserId = (userId) => get(`/collect/collectOfUserId?userId=${userId}`);

// =====================原来项目没用的======================
//下载音乐
export const download = (url)  => Axios({
    method: 'get',
    url: url,
    responseType: 'blob'
});

//===========评价======================
//提交评分
export const setRank =(params) => post(`/rank/add`,params);
//获取指定歌单的平均分
export const getRankOfSongListId = (songListId) => get(`/rank?songListId=${songListId}`);

//===========评论======================
//提交评论
export const setComment =(params) => post(`/comment/add`,params);
//点赞
export const setLike =(params) => post(`/comment/like`,params);
//返回当前歌单或歌曲的评论列表
export const getAllComment = (type,id) => {
    if(type == 0){              //歌曲
        return get(`/comment/commentOfSongId?songId=${id}`);
    }else{                      //歌单
        return get(`/comment/commentOfSongListId?songListId=${id}`);
    }
}

//===============收藏===================
//新增收藏
export const setCollect =(params) => post(`/collect/add`,params);
//指定用户的收藏列表

//============歌曲相关================
//根据歌手id查询歌曲
export const songOfSingerId =(id) => get(`song/singer/detail?singerId=${id}`);

//根据歌手名字模糊查询歌曲
export const likeSongOfName =(keywords) => get(`song/likeSongOfName?songName=${keywords}`);


export const getSongListOfLikeTitle = (keywords) => get(`songList/likeTitle?title=${keywords}`);

export const getSongListOfLikeStyle = (style) => get(`songList/likeStyle?style=${style}`);

